import logging.config
import logging.handlers
import pathlib
import json

logger = logging.getLogger("my_app")


def setup_logger():
    config_file = pathlib.Path("logger/config.json")
    config = json.loads(config_file.read_text())
    # print(config)
    
    logging.config.dictConfig(config)


def main():
    setup_logger()
    logger.debug("debug message")
    logger.info("info message")
    logger.warning("warn message")
    logger.error("error message")
    logger.critical("critical message")
    try:
        1 / 0
    except Exception as e:
        logger.exception(e)


if __name__ == "__main__":
    main()
